//导入我们之前封装好的接口
import request from "@/utils/requset";
// 导入格式转换
import YAML from "json2yaml";
import yaml from "js-yaml";
//封装一个建图的接口
export const mapgeApit = (data) => {
  return request({
    //这里的requset是基地址
    url: "/mwrobot/slam/start_map", //这个请求的地址
    method: "POST",
    data: YAML.stringify(data),
  });
};


//点击应用切换地图
export const overApi=(data)=>{
  return request({
    url:'/mwrobot/slam/load_map',
    method:'POST',
    data:YAML.stringify(data)
  })
}

//封装一个保存地图的接口请求
export const saveApi = (database) => {
  return request({
    url: "/mwrobot/slam/save_map",
    method: "POST",
    data: YAML.stringify(database),
    error: false,
  });
};

//封装一个删除地图的接口请求
export const deleteApi = (params) => {
  return request({
    url: "/mwrobot/slam/delete_map",
    method: "POST",
    data: YAML.stringify(params),
    error: false,
  });
};

//封装一个新建地图接口请求
export const addApi = (data) => {
  return request({
    url: "/mwrobot/slam/list_map",
    method: "POST",
    data: YAML.stringify(data),
  });
};

//封装一个上传图片到服务器的接口
export const putApi = (data) => {
  return request({
    url: "/maps/projects",
    method: "POST",
    data: YAML.stringify(data),
  });
};

// 封装一个从服务器下载图片到本地的接口coordinate system
export const downloadApi = (data) => {
  return request({
    url: "/maps/projects/download",
    method: "POST",
    data: YAML.stringify(data),
  });
};

// 封装一个从服务器下载图片到本地的接口coordinate system
export const cancelApi = (data) => {
  return request({
    url: "/mwrobot/slam/map_cancel",
    method: "POST",
    data: YAML.stringify(data),
  });
};


//点击列表每一项触发切换图片
export const getpicApi=(data)=>{
  return request({
    url:'/mwrobot/slam/view_map',
    method:"POST",
    data:YAML.stringify(data)
  })
}
